﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace SpringStudio.DAL
{
    /// <summary>
    /// 数据库访问层接口定义
    /// </summary>
    interface IDataBase
    {
        #region ExecuteDataSet接口的定义
        DataSet ExecuteDataSet(IDbConnection connection, CommandType commandType, string commandText, params IDbDataParameter[] commandParameters);
        DataSet ExecuteDataSet(IDbConnection connection, CommandType commandType, string commandText);
        DataSet ExecuteDataSet(string connectionString, CommandType commandType, string commandText, params IDbDataParameter[] commandParameters);
        DataSet ExecuteDataSet(string connectionString, CommandType commandType, string commandText);
        DataSet ExecuteDataSet(IDbTransaction transaction, CommandType commandType, string commandText, params IDbDataParameter[] commandParameters);
        DataSet ExecuteDataSet(IDbTransaction transaction, CommandType commandType, string commandText);
        #endregion

        #region ExecuteNonQuery接口的定义
        int ExecuteNonQuery(IDbConnection connection, CommandType commandType, string commandText, params IDbDataParameter[] commandParameters);
        int ExecuteNonQuery(IDbConnection connection, CommandType commandType, string commandText);
        int ExecuteNonQuery(string connectionString, CommandType commandType, string commandText, params IDbDataParameter[] commandParameters);
        int ExecuteNonQuery(string connectionString, CommandType commandType, string commandText);
        int ExecuteNonQuery(IDbTransaction transaction, CommandType commandType, string commandText, params IDbDataParameter[] commandParameters);
        int ExecuteNonQuery(IDbTransaction transaction, CommandType commandType, string commandText);
        #endregion

        #region Transaction接口的定义
        IDbTransaction GetTransaction(string connectionString);
        void CommitTransaction(IDbTransaction transaction);
        void RollbackTransaction(IDbTransaction transaction);
        #endregion

        #region 新建SQL参数的定义
        IDbDataParameter NewSqlParameter(string parameterName, object parameterValue, SqlDbType dbType);
        IDbDataParameter NewSqlParameter(string parameterName, object parameterValue);
        #endregion
    }
}
